package com.byq.mm.application.cluster.server;

import com.byq.mm.abstractx.device.Device;
import com.byq.mm.abstractx.engine.CoreEnvironment;
import com.byq.mm.abstractx.protocol.Interaction;
import com.byq.mm.application.cluster.provider.ObdProvider;
import com.byq.mm.foundation.cluster.datatype.AttributeValue;
import com.byq.mm.foundation.cluster.server.BasicClusterServer;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;


public class ObdServer extends BasicClusterServer {
	Map<String, String> values = new HashMap<String, String>();
	@Override
	protected void attributeWritten(String attributeName, AttributeValue value) {
		
	}
	public void response(String request,String response){
		values.put(request, response);
		Interaction i = this.createReport();
		i.command = ObdProvider.Define.ServerCommand.OBD_RESPONSE;
		i.attributes.put("request", request);
		i.attributes.put("response", response);
		env.getExtensionManager().sendInteraction(i,
				getDevice().getTransportId());
	}
	public ObdServer(String cluster, Device device, CoreEnvironment env) {
		super(cluster, device, env);
	}

	@Override
	public boolean onCommand(Interaction i, String transport) {
		return super.onCommand(i, transport);
		
		
		
	}
	
	@Override
	protected Class<? extends AttributeValue> getAttributeType(String attributeName) {
		
		throw new RuntimeException("no attribute in this cluster!");
	}

	@Override
	protected void init() {
		
	}


}
